package org.visionlibrary.image.filters.effects;

import java.awt.Point;
import java.util.Random;

import javax.media.jai.TiledImage;

import org.visionlibrary.image.model.WindowFilter;


final public class RandomFilter extends WindowFilter {
	protected int width;

	protected int height;

	protected Random rand = new Random();

	public RandomFilter(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public RandomFilter(int size) {
		this(size, size);
	}

	public RandomFilter() {
		this(9);
	}

	protected int getNewPixelVal(TiledImage src, Point p, int channel) {
		int x = rand.nextInt(windowWidth);
		int y = rand.nextInt(windowHeight);

		return getWindowPixelVal(src, new Point(x, y), channel);
	}

	protected void setWindowProperties() {
		windowWidth = width;
		windowHeight = height;
		dstPointInWindow = new Point(width / 2, height / 2);
	}
}
